{% extends "base.html" %}
{% load lines %}

{% block in_head %}
        <script src="/assets/js/accordion.js"></script>
{% endblock %}

{% block content %}
    {% block introduction %}{% endblock %}
    {% include "pager.html" %}
    {% for m in messages %}
        <div id="msg-{{m.id}}" class="msg msg-{{m.get_importance_display|lower}}">
            <form class="discard" action="{% url discard-message m.id %}" method="post">{% csrf_token %}
                <input type="image" src="/assets/icons/close.png" alt="Discard" title="Discard">
            </form>
            <h3><a href="{% url cron-by-host m.host %}">{{m.host}}</a>: <a href="{{m.get_absolute_url}}">{{m.subject}}</a></h3>
            <p class="date">{{m.date|date:"jS F Y g:ia"}}</p>
            {% if m.tags.count %}<p class="tags"><strong>Tags:</strong> {% for t in m.tags.all %}{% if not forloop.first %}, {% endif %}<a href="{{t.get_absolute_url}}">{{t}}</a>{% endfor %}</p>{% endif %}
            <div class="body">
                {% if m.body|lines < 50 %}
                    <pre>{{m.body}}</pre>
                {% else %}
                    <pre>{{m.body|truncatelines}}
                    
*snip*</pre>
                    <p><a href="{{m.get_absolute_url}}">See full message...</a></p>
                {% endif %}
                {% with m as message %}
                    {% include "cron/message-actions.html" %}
                {% endwith %}
            </div>
        </div>
    {% endfor %}
    {% include "pager.html" %}
{% endblock %}

